package com.ruoyi.basic.service.impl;

import com.ruoyi.basic.domain.MaterialInfo;
import com.ruoyi.basic.mapper.MaterialInfoMapper;
import com.ruoyi.basic.service.IMaterialInfoService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 物料信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-08-13
 */
@Service
public class MaterialInfoServiceImpl implements IMaterialInfoService 
{
    @Autowired
    private MaterialInfoMapper materialInfoMapper;

    /**
     * 查询物料信息
     * 
     * @param miId 物料信息主键
     * @return 物料信息
     */
    @Override
    public MaterialInfo selectMaterialInfoByMiId(Long miId)
    {
        return materialInfoMapper.selectMaterialInfoByMiId(miId);
    }

    /**
     * 查询物料信息列表
     * 
     * @param materialInfo 物料信息
     * @return 物料信息
     */
    @Override
    public List<MaterialInfo> selectMaterialInfoList(MaterialInfo materialInfo)
    {
        return materialInfoMapper.selectMaterialInfoList(materialInfo);
    }

    @Override
    public List<MaterialInfo> selectMaterialInfoAndCategory(MaterialInfo materialInfo) {
        return materialInfoMapper.selectMaterialInfoAndCategory(materialInfo);
    }

    /**
     * 新增物料信息
     * 
     * @param materialInfo 物料信息
     * @return 结果
     */
    @Override
    public int insertMaterialInfo(MaterialInfo materialInfo)
    {
        materialInfo.setCreateTime(DateUtils.getNowDate());
        return materialInfoMapper.insertMaterialInfo(materialInfo);
    }

    /**
     * 修改物料信息
     * 
     * @param materialInfo 物料信息
     * @return 结果
     */
    @Override
    public int updateMaterialInfo(MaterialInfo materialInfo)
    {
        materialInfo.setUpdateTime(DateUtils.getNowDate());
        return materialInfoMapper.updateMaterialInfo(materialInfo);
    }

    /**
     * 批量删除物料信息
     * 
     * @param miIds 需要删除的物料信息主键
     * @return 结果
     */
    @Override
    public int deleteMaterialInfoByMiIds(Long[] miIds)
    {
        return materialInfoMapper.deleteMaterialInfoByMiIds(miIds);
    }

    /**
     * 删除物料信息信息
     * 
     * @param miId 物料信息主键
     * @return 结果
     */
    @Override
    public int deleteMaterialInfoByMiId(Long miId)
    {
        return materialInfoMapper.deleteMaterialInfoByMiId(miId);
    }
}
